<% title "#{@language} - Libraries.io" %>
<% description "A detailed listing of the most popular, recently updated and most watched #{@language} packages online" %>
<% content_for :atom, auto_discovery_link_tag(:atom, search_url(languages: @language, sort: 'latest_release_published_at', order: 'desc', format: :atom), title: "Updated #{@language} Packages") %>
<% content_for :atom, auto_discovery_link_tag(:atom, search_url(languages: @language, sort: 'created_at', order: 'desc', format: :atom), title: "New #{@language} Packages") %>

<div class="row">
  <div class="col-sm-6">
    <h1>
      <div class="pictogram pictogram-lg pictogram-<%= @language.downcase %>"></div>
      <%= @language %>
    </h1>
  </div>
  <div class="col-sm-6">
    <br>
    <p>
      Total Packages: <%= number_with_delimiter Project.language(@language).count %>
    </p>
  </div>
</div>

<hr>

<div class="row">
  <div class="col-md-8">
    <div class="row">
      <% if @popular.any? %>
      <div class='col-sm-6 platform-column'>
        <h4>
          Popular <%= @language %> Packages
          <small class='more'>
            <%= link_to 'See more &raquo;'.html_safe, search_path(languages: @language, sort: 'rank', order: 'desc') %>
          </small>
        </h4>
        <%= render @popular %>
      </div>
      <% end %>

      <% if @created.any? %>
      <div class='col-sm-6 platform-column'>
        <h4>
          <%= link_to search_url(languages: @language, sort: 'created_at', order: 'desc', format: :atom), class: 'rss' do %>
            <%= fa_icon "rss-square" %>
          <% end %>
          New <%= @language %> Packages
          <%= link_to 'See more &raquo;'.html_safe, search_path(languages: @language, sort: 'created_at', order: 'desc') %>
        </h4>
        <%= render @created %>
      </div>
      <% end %>
      <% if @updated.any? %>
      <div class='col-sm-6 platform-column'>
        <h4>
          <%= link_to search_url(languages: @language, sort: 'latest_release_published_at', order: 'desc', format: :atom), class: 'rss' do %>
            <%= fa_icon "rss-square" %>
          <% end %>
          Updated <%= @language %> Packages
          <small>
            <%= link_to 'See more &raquo;'.html_safe, search_path(languages: @language, sort: 'latest_release_published_at', order: 'desc') %>
          </small>
        </h4>
        <%= render @updated %>
      </div>
      <% end %>
      <% if @dependend.any? %>
        <div class='col-sm-6 platform-column'>
          <h4>Most Depended upon <%= @language %> Packages</h4>
          <%= render @dependend %>
        </div>
      <% end %>
    </div>
  </div>
  <div class="col-md-4">
    <div class="row">
      <% if @licenses.many? %>
        <div class='col-md-12 col-sm-4'>
          <h4>
            <%= fa_icon 'gavel' %>
            Top <%= @language %> Licenses
          </h4>
          <%= render partial: 'licenses/list_license', collection: @licenses, as: :license %>
        </div>
      <% end %>

      <% if @platforms.many? %>
        <div class='col-md-12 col-sm-4'>
          <h4>
            <%= fa_icon 'archive' %>
            Top <%= @language %> Package Managers
          </h4>
          <%= render partial: 'platforms/list_platform', collection: @platforms, as: :platform %>
        </div>
      <% end %>

      <% if @keywords.many? %>
        <div class='col-md-12 col-sm-4'>
          <h4>
            <%= fa_icon 'tags' %>
            Top <%= @language %> Keywords
          </h4>
          <%= render partial: 'keywords/list_keyword', collection: @keywords, as: :keyword %>
        </div>
      <% end %>
    </div>
  </div>
</div>
